package com.zut.controller.category;

import com.zut.service.CategoryService;
import com.zut.service.impl.CategoryServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 张晨
 * @date 2024/9/7 9:25
 * @desc
 */
@WebServlet("/category/delete")
public class CategoryDeleteController extends HttpServlet {
    private CategoryService CategoryService = new CategoryServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        Integer count = CategoryService.deleteCategoryById(Integer.parseInt(id));

        resp.getWriter().write(count+"");

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}
